<!doctype html>
<html>
<head>
<meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'>
<title>cloud_06</title><link href='https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext' rel='stylesheet' type='text/css' /><style type='text/css'>html {overflow-x: initial !important;}:root { --node-fill: #ECECFF; --node-border: #CCCCFF; --cluster-fill: #ffffde; --cluster-border: #aaaa33; --note-fill: #fff5ad; --note-border: #aaaa33; --mermaid-color: var(--text-color); }


:root { --bg-color:#ffffff; --text-color:#333333; --select-text-bg-color:#B5D6FC; --select-text-font-color:auto; --monospace:"Lucida Console",Consolas,"Courier",monospace; --title-bar-height:20px; }
.mac-os-11 { --title-bar-height:28px; }
html { font-size: 14px; background-color: var(--bg-color); color: var(--text-color); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { margin: 0px; padding: 0px; height: auto; bottom: 0px; top: 0px; left: 0px; right: 0px; font-size: 1rem; line-height: 1.42857; overflow-x: hidden; background: inherit; tab-size: 4; }
iframe { margin: auto; }
a.url { word-break: break-all; }
a:active, a:hover { outline: 0px; }
.in-text-selection, ::selection { text-shadow: none; background: var(--select-text-bg-color); color: var(--select-text-font-color); }
#write { margin: 0px auto; height: auto; width: inherit; word-break: normal; overflow-wrap: break-word; position: relative; white-space: normal; overflow-x: visible; padding-top: 36px; }
#write.first-line-indent p { text-indent: 2em; }
#write.first-line-indent li p, #write.first-line-indent p * { text-indent: 0px; }
#write.first-line-indent li { margin-left: 2em; }
.for-image #write { padding-left: 8px; padding-right: 8px; }
body.typora-export { padding-left: 30px; padding-right: 30px; }
.typora-export .footnote-line, .typora-export li, .typora-export p { white-space: pre-wrap; }
.typora-export .task-list-item input { pointer-events: none; }
@media screen and (max-width: 500px) {
  body.typora-export { padding-left: 0px; padding-right: 0px; }
  #write { padding-left: 20px; padding-right: 20px; }
  .CodeMirror-sizer { margin-left: 0px !important; }
  .CodeMirror-gutters { display: none !important; }
}
#write li > figure:last-child { margin-bottom: 0.5rem; }
#write ol, #write ul { position: relative; }
img { max-width: 100%; vertical-align: middle; image-orientation: from-image; }
button, input, select, textarea { color: inherit; font: inherit; }
input[type="checkbox"], input[type="radio"] { line-height: normal; padding: 0px; }
*, ::after, ::before { box-sizing: border-box; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p, #write pre { width: inherit; }
#write h1, #write h2, #write h3, #write h4, #write h5, #write h6, #write p { position: relative; }
p { line-height: inherit; }
h1, h2, h3, h4, h5, h6 { break-after: avoid-page; break-inside: avoid; orphans: 4; }
p { orphans: 4; }
h1 { font-size: 2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.6rem; }
h4 { font-size: 1.4rem; }
h5 { font-size: 1.2rem; }
h6 { font-size: 1rem; }
.md-math-block, .md-rawblock, h1, h2, h3, h4, h5, h6, p { margin-top: 1rem; margin-bottom: 1rem; }
.hidden { display: none; }
.md-blockmeta { color: rgb(204, 204, 204); font-weight: 700; font-style: italic; }
a { cursor: pointer; }
sup.md-footnote { padding: 2px 4px; background-color: rgba(238, 238, 238, 0.7); color: rgb(85, 85, 85); border-radius: 4px; cursor: pointer; }
sup.md-footnote a, sup.md-footnote a:hover { color: inherit; text-transform: inherit; text-decoration: inherit; }
#write input[type="checkbox"] { cursor: pointer; width: inherit; height: inherit; }
figure { overflow-x: auto; margin: 1.2em 0px; max-width: calc(100% + 16px); padding: 0px; }
figure > table { margin: 0px; }
tr { break-inside: avoid; break-after: auto; }
thead { display: table-header-group; }
table { border-collapse: collapse; border-spacing: 0px; width: 100%; overflow: auto; break-inside: auto; text-align: left; }
table.md-table td { min-width: 32px; }
.CodeMirror-gutters { border-right: 0px; background-color: inherit; }
.CodeMirror-linenumber { user-select: none; }
.CodeMirror { text-align: left; }
.CodeMirror-placeholder { opacity: 0.3; }
.CodeMirror pre { padding: 0px 4px; }
.CodeMirror-lines { padding: 0px; }
div.hr:focus { cursor: none; }
#write pre { white-space: pre-wrap; }
#write.fences-no-line-wrapping pre { white-space: pre; }
#write pre.ty-contain-cm { white-space: normal; }
.CodeMirror-gutters { margin-right: 4px; }
.md-fences { font-size: 0.9rem; display: block; break-inside: avoid; text-align: left; overflow: visible; white-space: pre; background: inherit; position: relative !important; }
.md-diagram-panel { width: 100%; margin-top: 10px; text-align: center; padding-top: 0px; padding-bottom: 8px; overflow-x: auto; }
#write .md-fences.mock-cm { white-space: pre-wrap; }
.md-fences.md-fences-with-lineno { padding-left: 0px; }
#write.fences-no-line-wrapping .md-fences.mock-cm { white-space: pre; overflow-x: auto; }
.md-fences.mock-cm.md-fences-with-lineno { padding-left: 8px; }
.CodeMirror-line, twitterwidget { break-inside: avoid; }
.footnotes { opacity: 0.8; font-size: 0.9rem; margin-top: 1em; margin-bottom: 1em; }
.footnotes + .footnotes { margin-top: 0px; }
.md-reset { margin: 0px; padding: 0px; border: 0px; outline: 0px; vertical-align: top; background: 0px 0px; text-decoration: none; text-shadow: none; float: none; position: static; width: auto; height: auto; white-space: nowrap; cursor: inherit; -webkit-tap-highlight-color: transparent; line-height: normal; font-weight: 400; text-align: left; box-sizing: content-box; direction: ltr; }
li div { padding-top: 0px; }
blockquote { margin: 1rem 0px; }
li .mathjax-block, li p { margin: 0.5rem 0px; }
li blockquote { margin: 1rem 0px; }
li { margin: 0px; position: relative; }
blockquote > :last-child { margin-bottom: 0px; }
blockquote > :first-child, li > :first-child { margin-top: 0px; }
.footnotes-area { color: rgb(136, 136, 136); margin-top: 0.714rem; padding-bottom: 0.143rem; white-space: normal; }
#write .footnote-line { white-space: pre-wrap; }
@media print {
  body, html { border: 1px solid transparent; height: 99%; break-after: avoid; break-before: avoid; font-variant-ligatures: no-common-ligatures; }
  #write { margin-top: 0px; padding-top: 0px; border-color: transparent !important; }
  .typora-export * { -webkit-print-color-adjust: exact; }
  .typora-export #write { break-after: avoid; }
  .typora-export #write::after { height: 0px; }
  .is-mac table { break-inside: avoid; }
}
.footnote-line { margin-top: 0.714em; font-size: 0.7em; }
a img, img a { cursor: pointer; }
pre.md-meta-block { font-size: 0.8rem; min-height: 0.8rem; white-space: pre-wrap; background: rgb(204, 204, 204); display: block; overflow-x: hidden; }
p > .md-image:only-child:not(.md-img-error) img, p > img:only-child { display: block; margin: auto; }
#write.first-line-indent p > .md-image:only-child:not(.md-img-error) img { left: -2em; position: relative; }
p > .md-image:only-child { display: inline-block; width: 100%; }
#write .MathJax_Display { margin: 0.8em 0px 0px; }
.md-math-block { width: 100%; }
.md-math-block:not(:empty)::after { display: none; }
.MathJax_ref { fill: currentcolor; }
[contenteditable="true"]:active, [contenteditable="true"]:focus, [contenteditable="false"]:active, [contenteditable="false"]:focus { outline: 0px; box-shadow: none; }
.md-task-list-item { position: relative; list-style-type: none; }
.task-list-item.md-task-list-item { padding-left: 0px; }
.md-task-list-item > input { position: absolute; top: 0px; left: 0px; margin-left: -1.2em; margin-top: calc(1em - 10px); border: none; }
.math { font-size: 1rem; }
.md-toc { min-height: 3.58rem; position: relative; font-size: 0.9rem; border-radius: 10px; }
.md-toc-content { position: relative; margin-left: 0px; }
.md-toc-content::after, .md-toc::after { display: none; }
.md-toc-item { display: block; color: rgb(65, 131, 196); }
.md-toc-item a { text-decoration: none; }
.md-toc-inner:hover { text-decoration: underline; }
.md-toc-inner { display: inline-block; cursor: pointer; }
.md-toc-h1 .md-toc-inner { margin-left: 0px; font-weight: 700; }
.md-toc-h2 .md-toc-inner { margin-left: 2em; }
.md-toc-h3 .md-toc-inner { margin-left: 4em; }
.md-toc-h4 .md-toc-inner { margin-left: 6em; }
.md-toc-h5 .md-toc-inner { margin-left: 8em; }
.md-toc-h6 .md-toc-inner { margin-left: 10em; }
@media screen and (max-width: 48em) {
  .md-toc-h3 .md-toc-inner { margin-left: 3.5em; }
  .md-toc-h4 .md-toc-inner { margin-left: 5em; }
  .md-toc-h5 .md-toc-inner { margin-left: 6.5em; }
  .md-toc-h6 .md-toc-inner { margin-left: 8em; }
}
a.md-toc-inner { font-size: inherit; font-style: inherit; font-weight: inherit; line-height: inherit; }
.footnote-line a:not(.reversefootnote) { color: inherit; }
.md-attr { display: none; }
.md-fn-count::after { content: "."; }
code, pre, samp, tt { font-family: var(--monospace); }
kbd { margin: 0px 0.1em; padding: 0.1em 0.6em; font-size: 0.8em; color: rgb(36, 39, 41); background: rgb(255, 255, 255); border: 1px solid rgb(173, 179, 185); border-radius: 3px; box-shadow: rgba(12, 13, 14, 0.2) 0px 1px 0px, rgb(255, 255, 255) 0px 0px 0px 2px inset; white-space: nowrap; vertical-align: middle; }
.md-comment { color: rgb(162, 127, 3); opacity: 0.8; font-family: var(--monospace); }
code { text-align: left; vertical-align: initial; }
a.md-print-anchor { white-space: pre !important; border-width: initial !important; border-style: none !important; border-color: initial !important; display: inline-block !important; position: absolute !important; width: 1px !important; right: 0px !important; outline: 0px !important; background: 0px 0px !important; text-decoration: initial !important; text-shadow: initial !important; }
.md-inline-math .MathJax_SVG .noError { display: none !important; }
.html-for-mac .inline-math-svg .MathJax_SVG { vertical-align: 0.2px; }
.md-math-block .MathJax_SVG_Display { text-align: center; margin: 0px; position: relative; text-indent: 0px; max-width: none; max-height: none; min-height: 0px; min-width: 100%; width: auto; overflow-y: hidden; display: block !important; }
.MathJax_SVG_Display, .md-inline-math .MathJax_SVG_Display { width: auto; margin: inherit; display: inline-block !important; }
.MathJax_SVG .MJX-monospace { font-family: var(--monospace); }
.MathJax_SVG .MJX-sans-serif { font-family: sans-serif; }
.MathJax_SVG { display: inline; font-style: normal; font-weight: 400; line-height: normal; zoom: 90%; text-indent: 0px; text-align: left; text-transform: none; letter-spacing: normal; word-spacing: normal; overflow-wrap: normal; white-space: nowrap; float: none; direction: ltr; max-width: none; max-height: none; min-width: 0px; min-height: 0px; border: 0px; padding: 0px; margin: 0px; }
.MathJax_SVG * { transition: none 0s ease 0s; }
.MathJax_SVG_Display svg { vertical-align: middle !important; margin-bottom: 0px !important; margin-top: 0px !important; }
.os-windows.monocolor-emoji .md-emoji { font-family: "Segoe UI Symbol", sans-serif; }
.md-diagram-panel > svg { max-width: 100%; }
[lang="flow"] svg, [lang="mermaid"] svg { max-width: 100%; height: auto; }
[lang="mermaid"] .node text { font-size: 1rem; }
table tr th { border-bottom: 0px; }
video { max-width: 100%; display: block; margin: 0px auto; }
iframe { max-width: 100%; width: 100%; border: none; }
.highlight td, .highlight tr { border: 0px; }
mark { background: rgb(255, 255, 0); color: rgb(0, 0, 0); }
.md-html-inline .md-plain, .md-html-inline strong, mark .md-inline-math, mark strong { color: inherit; }
mark .md-meta { color: rgb(0, 0, 0); opacity: 0.3 !important; }
@media print {
  .typora-export h1, .typora-export h2, .typora-export h3, .typora-export h4, .typora-export h5, .typora-export h6 { break-inside: avoid; }
}
.md-diagram-panel .messageText { stroke: none !important; }
.md-diagram-panel .start-state { fill: var(--node-fill); }
.md-diagram-panel .edgeLabel rect { opacity: 1 !important; }
.md-require-zoom-fix foreignobject { font-size: var(--mermaid-font-zoom); }


.CodeMirror { height: auto; }
.CodeMirror.cm-s-inner { background: inherit; }
.CodeMirror-scroll { overflow: auto hidden; z-index: 3; }
.CodeMirror-gutter-filler, .CodeMirror-scrollbar-filler { background-color: rgb(255, 255, 255); }
.CodeMirror-gutters { border-right: 1px solid rgb(221, 221, 221); background: inherit; white-space: nowrap; }
.CodeMirror-linenumber { padding: 0px 3px 0px 5px; text-align: right; color: rgb(153, 153, 153); }
.cm-s-inner .cm-keyword { color: rgb(119, 0, 136); }
.cm-s-inner .cm-atom, .cm-s-inner.cm-atom { color: rgb(34, 17, 153); }
.cm-s-inner .cm-number { color: rgb(17, 102, 68); }
.cm-s-inner .cm-def { color: rgb(0, 0, 255); }
.cm-s-inner .cm-variable { color: rgb(0, 0, 0); }
.cm-s-inner .cm-variable-2 { color: rgb(0, 85, 170); }
.cm-s-inner .cm-variable-3 { color: rgb(0, 136, 85); }
.cm-s-inner .cm-string { color: rgb(170, 17, 17); }
.cm-s-inner .cm-property { color: rgb(0, 0, 0); }
.cm-s-inner .cm-operator { color: rgb(152, 26, 26); }
.cm-s-inner .cm-comment, .cm-s-inner.cm-comment { color: rgb(170, 85, 0); }
.cm-s-inner .cm-string-2 { color: rgb(255, 85, 0); }
.cm-s-inner .cm-meta { color: rgb(85, 85, 85); }
.cm-s-inner .cm-qualifier { color: rgb(85, 85, 85); }
.cm-s-inner .cm-builtin { color: rgb(51, 0, 170); }
.cm-s-inner .cm-bracket { color: rgb(153, 153, 119); }
.cm-s-inner .cm-tag { color: rgb(17, 119, 0); }
.cm-s-inner .cm-attribute { color: rgb(0, 0, 204); }
.cm-s-inner .cm-header, .cm-s-inner.cm-header { color: rgb(0, 0, 255); }
.cm-s-inner .cm-quote, .cm-s-inner.cm-quote { color: rgb(0, 153, 0); }
.cm-s-inner .cm-hr, .cm-s-inner.cm-hr { color: rgb(153, 153, 153); }
.cm-s-inner .cm-link, .cm-s-inner.cm-link { color: rgb(0, 0, 204); }
.cm-negative { color: rgb(221, 68, 68); }
.cm-positive { color: rgb(34, 153, 34); }
.cm-header, .cm-strong { font-weight: 700; }
.cm-del { text-decoration: line-through; }
.cm-em { font-style: italic; }
.cm-link { text-decoration: underline; }
.cm-error { color: red; }
.cm-invalidchar { color: red; }
.cm-constant { color: rgb(38, 139, 210); }
.cm-defined { color: rgb(181, 137, 0); }
div.CodeMirror span.CodeMirror-matchingbracket { color: rgb(0, 255, 0); }
div.CodeMirror span.CodeMirror-nonmatchingbracket { color: rgb(255, 34, 34); }
.cm-s-inner .CodeMirror-activeline-background { background: inherit; }
.CodeMirror { position: relative; overflow: hidden; }
.CodeMirror-scroll { height: 100%; outline: 0px; position: relative; box-sizing: content-box; background: inherit; }
.CodeMirror-sizer { position: relative; }
.CodeMirror-gutter-filler, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-vscrollbar { position: absolute; z-index: 6; display: none; }
.CodeMirror-vscrollbar { right: 0px; top: 0px; overflow: hidden; }
.CodeMirror-hscrollbar { bottom: 0px; left: 0px; overflow: hidden; }
.CodeMirror-scrollbar-filler { right: 0px; bottom: 0px; }
.CodeMirror-gutter-filler { left: 0px; bottom: 0px; }
.CodeMirror-gutters { position: absolute; left: 0px; top: 0px; padding-bottom: 30px; z-index: 3; }
.CodeMirror-gutter { white-space: normal; height: 100%; box-sizing: content-box; padding-bottom: 30px; margin-bottom: -32px; display: inline-block; }
.CodeMirror-gutter-wrapper { position: absolute; z-index: 4; background: 0px 0px !important; border: none !important; }
.CodeMirror-gutter-background { position: absolute; top: 0px; bottom: 0px; z-index: 4; }
.CodeMirror-gutter-elt { position: absolute; cursor: default; z-index: 4; }
.CodeMirror-lines { cursor: text; }
.CodeMirror pre { border-radius: 0px; border-width: 0px; background: 0px 0px; font-family: inherit; font-size: inherit; margin: 0px; white-space: pre; overflow-wrap: normal; color: inherit; z-index: 2; position: relative; overflow: visible; }
.CodeMirror-wrap pre { overflow-wrap: break-word; white-space: pre-wrap; word-break: normal; }
.CodeMirror-code pre { border-right: 30px solid transparent; width: fit-content; }
.CodeMirror-wrap .CodeMirror-code pre { border-right: none; width: auto; }
.CodeMirror-linebackground { position: absolute; left: 0px; right: 0px; top: 0px; bottom: 0px; z-index: 0; }
.CodeMirror-linewidget { position: relative; z-index: 2; overflow: auto; }
.CodeMirror-wrap .CodeMirror-scroll { overflow-x: hidden; }
.CodeMirror-measure { position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden; }
.CodeMirror-measure pre { position: static; }
.CodeMirror div.CodeMirror-cursor { position: absolute; visibility: hidden; border-right: none; width: 0px; }
.CodeMirror div.CodeMirror-cursor { visibility: hidden; }
.CodeMirror-focused div.CodeMirror-cursor { visibility: inherit; }
.cm-searching { background: rgba(255, 255, 0, 0.4); }
@media print {
  .CodeMirror div.CodeMirror-cursor { visibility: hidden; }
}


:root {
    --side-bar-bg-color: #fafafa;
    --control-text-color: #777;
}

@include-when-export url(https://fonts.loli.net/css?family=Open+Sans:400italic,700italic,700,400&subset=latin,latin-ext);

/* open-sans-regular - latin-ext_latin */
  /* open-sans-italic - latin-ext_latin */
    /* open-sans-700 - latin-ext_latin */
    /* open-sans-700italic - latin-ext_latin */
  html {
    font-size: 16px;
}

body {
    font-family: "Open Sans","Clear Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    color: rgb(51, 51, 51);
    line-height: 1.6;
}

#write {
    max-width: 860px;
  	margin: 0 auto;
  	padding: 30px;
    padding-bottom: 100px;
}

@media only screen and (min-width: 1400px) {
	#write {
		max-width: 1024px;
	}
}

@media only screen and (min-width: 1800px) {
	#write {
		max-width: 1200px;
	}
}

#write > ul:first-child,
#write > ol:first-child{
    margin-top: 30px;
}

a {
    color: #4183C4;
}
h1,
h2,
h3,
h4,
h5,
h6 {
    position: relative;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: bold;
    line-height: 1.4;
    cursor: text;
}
h1:hover a.anchor,
h2:hover a.anchor,
h3:hover a.anchor,
h4:hover a.anchor,
h5:hover a.anchor,
h6:hover a.anchor {
    text-decoration: none;
}
h1 tt,
h1 code {
    font-size: inherit;
}
h2 tt,
h2 code {
    font-size: inherit;
}
h3 tt,
h3 code {
    font-size: inherit;
}
h4 tt,
h4 code {
    font-size: inherit;
}
h5 tt,
h5 code {
    font-size: inherit;
}
h6 tt,
h6 code {
    font-size: inherit;
}
h1 {
    font-size: 2.25em;
    line-height: 1.2;
    border-bottom: 1px solid #eee;
}
h2 {
    font-size: 1.75em;
    line-height: 1.225;
    border-bottom: 1px solid #eee;
}

/*@media print {
    .typora-export h1,
    .typora-export h2 {
        border-bottom: none;
        padding-bottom: initial;
    }

    .typora-export h1::after,
    .typora-export h2::after {
        content: "";
        display: block;
        height: 100px;
        margin-top: -96px;
        border-top: 1px solid #eee;
    }
}*/

h3 {
    font-size: 1.5em;
    line-height: 1.43;
}
h4 {
    font-size: 1.25em;
}
h5 {
    font-size: 1em;
}
h6 {
   font-size: 1em;
    color: #777;
}
p,
blockquote,
ul,
ol,
dl,
table{
    margin: 0.8em 0;
}
li>ol,
li>ul {
    margin: 0 0;
}
hr {
    height: 2px;
    padding: 0;
    margin: 16px 0;
    background-color: #e7e7e7;
    border: 0 none;
    overflow: hidden;
    box-sizing: content-box;
}

li p.first {
    display: inline-block;
}
ul,
ol {
    padding-left: 30px;
}
ul:first-child,
ol:first-child {
    margin-top: 0;
}
ul:last-child,
ol:last-child {
    margin-bottom: 0;
}
blockquote {
    border-left: 4px solid #dfe2e5;
    padding: 0 15px;
    color: #777777;
}
blockquote blockquote {
    padding-right: 0;
}
table {
    padding: 0;
    word-break: initial;
}
table tr {
    border-top: 1px solid #dfe2e5;
    margin: 0;
    padding: 0;
}
table tr:nth-child(2n),
thead {
    background-color: #f8f8f8;
}
table th {
    font-weight: bold;
    border: 1px solid #dfe2e5;
    border-bottom: 0;
    margin: 0;
    padding: 6px 13px;
}
table td {
    border: 1px solid #dfe2e5;
    margin: 0;
    padding: 6px 13px;
}
table th:first-child,
table td:first-child {
    margin-top: 0;
}
table th:last-child,
table td:last-child {
    margin-bottom: 0;
}

.CodeMirror-lines {
    padding-left: 4px;
}

.code-tooltip {
    box-shadow: 0 1px 1px 0 rgba(0,28,36,.3);
    border-top: 1px solid #eef2f2;
}

.md-fences,
code,
tt {
    border: 1px solid #e7eaed;
    background-color: #f8f8f8;
    border-radius: 3px;
    padding: 0;
    padding: 2px 4px 0px 4px;
    font-size: 0.9em;
}

code {
    background-color: #f3f4f4;
    padding: 0 2px 0 2px;
}

.md-fences {
    margin-bottom: 15px;
    margin-top: 15px;
    padding-top: 8px;
    padding-bottom: 6px;
}


.md-task-list-item > input {
  margin-left: -1.3em;
}

@media print {
    html {
        font-size: 13px;
    }
    table,
    pre {
        page-break-inside: avoid;
    }
    pre {
        word-wrap: break-word;
    }
}

.md-fences {
	background-color: #f8f8f8;
}
#write pre.md-meta-block {
	padding: 1rem;
    font-size: 85%;
    line-height: 1.45;
    background-color: #f7f7f7;
    border: 0;
    border-radius: 3px;
    color: #777777;
    margin-top: 0 !important;
}

.mathjax-block>.code-tooltip {
	bottom: .375rem;
}

.md-mathjax-midline {
    background: #fafafa;
}

#write>h3.md-focus:before{
	left: -1.5625rem;
	top: .375rem;
}
#write>h4.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h5.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
#write>h6.md-focus:before{
	left: -1.5625rem;
	top: .285714286rem;
}
.md-image>.md-meta {
    /*border: 1px solid #ddd;*/
    border-radius: 3px;
    padding: 2px 0px 0px 4px;
    font-size: 0.9em;
    color: inherit;
}

.md-tag {
    color: #a7a7a7;
    opacity: 1;
}

.md-toc { 
    margin-top:20px;
    padding-bottom:20px;
}

.sidebar-tabs {
    border-bottom: none;
}

#typora-quick-open {
    border: 1px solid #ddd;
    background-color: #f8f8f8;
}

#typora-quick-open-item {
    background-color: #FAFAFA;
    border-color: #FEFEFE #e5e5e5 #e5e5e5 #eee;
    border-style: solid;
    border-width: 1px;
}

/** focus mode */
.on-focus-mode blockquote {
    border-left-color: rgba(85, 85, 85, 0.12);
}

header, .context-menu, .megamenu-content, footer{
    font-family: "Segoe UI", "Arial", sans-serif;
}

.file-node-content:hover .file-node-icon,
.file-node-content:hover .file-node-open-state{
    visibility: visible;
}

.mac-seamless-mode #typora-sidebar {
    background-color: #fafafa;
    background-color: var(--side-bar-bg-color);
}

.md-lang {
    color: #b4654d;
}

.html-for-mac .context-menu {
    --item-hover-bg-color: #E6F0FE;
}

#md-notification .btn {
    border: 0;
}

.dropdown-menu .divider {
    border-color: #e5e5e5;
}

.ty-preferences .window-content {
    background-color: #fafafa;
}

.ty-preferences .nav-group-item.active {
    color: white;
    background: #999;
}

 :root {--mermaid-font-zoom:1.44em ;} 
</style>
</head>
<body class='typora-export os-windows'>
<div id='write'  class=''><h1><a name="kubernetes" class="md-header-anchor"></a><span>kubernetes</span></h1><div class='md-toc' mdtype='toc'><p class="md-toc-content" role="list"><span role="listitem" class="md-toc-item md-toc-h1" data-ref="n0"><a class="md-toc-inner" href="#kubernetes">kubernetes</a></span><span role="listitem" class="md-toc-item md-toc-h2" data-ref="n3"><a class="md-toc-inner" href="#service管理">service管理</a></span><span role="listitem" class="md-toc-item md-toc-h3" data-ref="n4"><a class="md-toc-inner" href="#clusterip">clusterIP</a></span><span role="listitem" class="md-toc-item md-toc-h3" data-ref="n16"><a class="md-toc-inner" href="#nodeport">NodePort</a></span><span role="listitem" class="md-toc-item md-toc-h3" data-ref="n19"><a class="md-toc-inner" href="#ingress">Ingress</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n21"><a class="md-toc-inner" href="#安装控制器ingress">安装控制器ingress</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n23"><a class="md-toc-inner" href="#创建后端服务">创建后端服务</a></span><span role="listitem" class="md-toc-item md-toc-h4" data-ref="n25"><a class="md-toc-inner" href="#对外发布服务">对外发布服务</a></span><span role="listitem" class="md-toc-item md-toc-h2" data-ref="n27"><a class="md-toc-inner" href="#web管理插件">web管理插件</a></span><span role="listitem" class="md-toc-item md-toc-h3" data-ref="n28"><a class="md-toc-inner" href="#安装dashboard">安装Dashboard</a></span><span role="listitem" class="md-toc-item md-toc-h3" data-ref="n30"><a class="md-toc-inner" href="#浏览器访问-dashboard">浏览器访问 Dashboard</a></span><span role="listitem" class="md-toc-item md-toc-h2" data-ref="n49"><a class="md-toc-inner" href="#服务账号与权限">服务账号与权限</a></span><span role="listitem" class="md-toc-item md-toc-h3" data-ref="n50"><a class="md-toc-inner" href="#serviceaccount">serviceaccount</a></span><span role="listitem" class="md-toc-item md-toc-h3" data-ref="n52"><a class="md-toc-inner" href="#角色与鉴权">角色与鉴权</a></span></p></div><h2><a name="service管理" class="md-header-anchor"></a><span>service管理</span></h2><h3><a name="clusterip" class="md-header-anchor"></a><span>clusterIP</span></h3><div class="md-diagram-panel"><svg id="mermaidChart0" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="353.7848815917969" style="max-width: 690.838px; height: 393.785px;" viewBox="0 0 690.8375244140625 353.7848815917969" class="md-require-zoom-fix"><style>#mermaidChart0{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:11.111110669595242px;fill:#333333;}#mermaidChart0 .error-icon{fill:hsl(60,100%,100%);}#mermaidChart0 .error-text{fill:rgb(0,0,0);stroke:rgb(0,0,0);}#mermaidChart0 .edge-thickness-normal{stroke-width:2px;}#mermaidChart0 .edge-thickness-thick{stroke-width:3.5px;}#mermaidChart0 .edge-pattern-solid{stroke-dasharray:0;}#mermaidChart0 .edge-pattern-dashed{stroke-dasharray:3;}#mermaidChart0 .edge-pattern-dotted{stroke-dasharray:2;}#mermaidChart0 .marker{fill:#000000;}#mermaidChart0 .marker.cross{stroke:#000000;}#mermaidChart0 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:11.111110669595242px;}#mermaidChart0 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaidChart0 .label text{fill:#333;}#mermaidChart0 .node rect,#mermaidChart0 .node circle,#mermaidChart0 .node ellipse,#mermaidChart0 .node polygon,#mermaidChart0 .node path{fill:#ECECFF;stroke:hsl(240,60%,86.2745098039%);stroke-width:1px;}#mermaidChart0 .node .label{text-align:center;}#mermaidChart0 .node.clickable{cursor:pointer;}#mermaidChart0 .arrowheadPath{fill:undefined;}#mermaidChart0 .edgePath .path{stroke:#000000;stroke-width:1.5px;}#mermaidChart0 .flowchart-link{stroke:#000000;fill:none;}#mermaidChart0 .edgeLabel{background-color:#f4f4f4;text-align:center;}#mermaidChart0 .edgeLabel rect{opacity:0.5;background-color:#f4f4f4;fill:#f4f4f4;}#mermaidChart0 .cluster rect{fill:hsl(60,100%,100%);stroke:hsl(60,60%,90%);stroke-width:1px;}#mermaidChart0 .cluster text{fill:rgb(0,0,0);}#mermaidChart0 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(60,100%,100%);border:1px solid undefined;border-radius:2px;pointer-events:none;z-index:100;}#mermaidChart0:root{--mermaid-font-family:sans-serif;}#mermaidChart0:root{--mermaid-alt-font-family:sans-serif;}#mermaidChart0 .Error &gt; *{fill:#ccffbb !important;color:#000000 !important;stroke-width:3px !important;stroke:#f06080 !important;stroke-dasharray:6 !important;3 !important;}#mermaidChart0 .Error tspan{fill:#000000 !important;}#mermaidChart0 .Cluster &gt; *{fill:#ffffc0 !important;color:#ff00ff !important;stroke-width:4px !important;}#mermaidChart0 .Cluster tspan{fill:#ff00ff !important;}#mermaidChart0 .Node &gt; *{fill:#a5a5f0 !important;color:#f0f0f0 !important;stroke:#f06080 !important;stroke-width:3px !important;}#mermaidChart0 .Node tspan{fill:#f0f0f0 !important;}#mermaidChart0 .Pod &gt; *{fill:#ccffbb !important;color:#000000 !important;stroke-width:3px !important;}#mermaidChart0 .Pod tspan{fill:#000000 !important;}#mermaidChart0 .User &gt; *{fill:#ccddee !important;color:#000000 !important;stroke:#555555 !important;stroke-width:3px !important;}#mermaidChart0 .User tspan{fill:#000000 !important;}#mermaidChart0 flowchart-v2{fill:apa;}</style><g transform="translate(0, 2)"><marker id="flowchart-pointEnd" class="marker flowchart" viewBox="0 0 10 10" refX="9" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-pointStart" class="marker flowchart" viewBox="0 0 10 10" refX="0" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-circleEnd" class="marker flowchart" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="flowchart-circleStart" class="marker flowchart" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="flowchart-crossEnd" class="marker cross flowchart" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-crossStart" class="marker cross flowchart" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><g class="root"><g class="clusters"></g><g class="edgePaths"></g><g class="edgeLabels"></g><g class="nodes"><g class="root" transform="translate(0, 0)"><g class="clusters"><g class="cluster Cluster" id="C1"><rect rx="0" ry="0" x="8" y="8" width="674.837516784668" height="335.78487396240234"></rect><g class="cluster-label" transform="translate(306.96625900268555, 6)"><foreignObject width="76.90499877929688" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>k8s cluster</span></div></foreignObject></g></g><g class="cluster Node" id="N1"><rect rx="0" ry="0" x="285.8200149536133" y="28" width="90.67250061035156" height="127.89243698120117"></rect><g class="cluster-label" transform="translate(293.9525146484375, 26)"><foreignObject width="74.40750122070312" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>node-0001</span></div></foreignObject></g></g><g class="cluster Node" id="N2"><rect rx="0" ry="0" x="426.49251556396484" y="111.94621849060059" width="90.67250061035156" height="127.89243698120117"></rect><g class="cluster-label" transform="translate(434.62501525878906, 109.94621849060059)"><foreignObject width="74.40750122070312" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>node-0002</span></div></foreignObject></g></g><g class="cluster Node" id="N3"><rect rx="0" ry="0" x="567.1650161743164" y="195.89243698120117" width="90.67250061035156" height="127.89243698120117"></rect><g class="cluster-label" transform="translate(575.2975158691406, 193.89243698120117)"><foreignObject width="74.40750122070312" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>node-0003</span></div></foreignObject></g></g></g><g class="edgePaths"><path d="M90.66000366210938,175.89243698120117L94.82667032877605,175.89243698120117C98.9933369954427,175.89243698120117,107.32667032877605,175.89243698120117,115.66000366210938,175.89243698120117C123.9933369954427,175.89243698120117,132.32667032877603,175.89243698120117,136.49333699544272,175.89243698120117L140.66000366210938,175.89243698120117" id="L-User-S1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-User LE-S1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M215.8899652110379,143.91242790222168L223.37830683480047,135.25139300028482C230.866648458563,126.59035809834798,245.84333170608815,109.26828829447429,257.49833999651736,100.60725339253743C269.1533482869466,91.94621849060059,277.48668162027997,91.94621849060059,285.8200149536133,91.94621849060059C294.1533482869466,91.94621849060059,302.48668162027997,91.94621849060059,306.6533482869466,91.94621849060059L310.8200149536133,91.94621849060059" id="L-S1-P1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S1 LE-P1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M235.82001495361328,175.89243698120117L239.98668162027994,175.89243698120117C244.15334828694662,175.89243698120117,252.48668162027994,175.89243698120117,260.8200149536133,175.89243698120117C269.1533482869466,175.89243698120117,277.48668162027997,175.89243698120117,289.2093900044759,175.89243698120117C300.9320983886719,175.89243698120117,316.04418182373047,175.89243698120117,331.15626525878906,175.89243698120117C346.26834869384766,175.89243698120117,361.38043212890625,175.89243698120117,373.10314051310223,175.89243698120117C384.82584889729816,175.89243698120117,393.15918223063153,175.89243698120117,401.49251556396484,175.89243698120117C409.82584889729816,175.89243698120117,418.15918223063153,175.89243698120117,426.49251556396484,175.89243698120117C434.82584889729816,175.89243698120117,443.15918223063153,175.89243698120117,447.32584889729816,175.89243698120117L451.49251556396484,175.89243698120117" id="L-S1-P2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S1 LE-P2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M215.8899652110379,207.87244606018066L223.37830683480047,216.53348096211752C230.866648458563,225.19451586405435,245.84333170608815,242.51658566792807,257.49833999651736,251.1776205698649C269.1533482869466,259.83865547180176,277.48668162027997,259.83865547180176,289.2093900044759,259.83865547180176C300.9320983886719,259.83865547180176,316.04418182373047,259.83865547180176,331.15626525878906,259.83865547180176C346.26834869384766,259.83865547180176,361.38043212890625,259.83865547180176,373.10314051310223,259.83865547180176C384.82584889729816,259.83865547180176,393.15918223063153,259.83865547180176,401.49251556396484,259.83865547180176C409.82584889729816,259.83865547180176,418.15918223063153,259.83865547180176,429.88189061482746,259.83865547180176C441.60459899902344,259.83865547180176,456.71668243408203,259.83865547180176,471.8287658691406,259.83865547180176C486.9408493041992,259.83865547180176,502.0529327392578,259.83865547180176,513.7756411234537,259.83865547180176C525.4983495076498,259.83865547180176,533.831682840983,259.83865547180176,542.1650161743164,259.83865547180176C550.4983495076498,259.83865547180176,558.831682840983,259.83865547180176,567.1650161743164,259.83865547180176C575.4983495076498,259.83865547180176,583.831682840983,259.83865547180176,587.9983495076498,259.83865547180176L592.1650161743164,259.83865547180176" id="L-S1-P3" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S1 LE-P3" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path></g><g class="edgeLabels"><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g></g><g class="nodes"><g class="node default Pod" id="flowchart-P1-10" label-offset-y="6.137485168104335" transform="translate(331.15626525878906, 91.94621849060059)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default User" id="flowchart-User-13" transform="translate(61.83000183105469, 175.89243698120117)"><circle rx="0" ry="0" r="28.830001831054688" width="57.660003662109375" height="39.47998046875"></circle><g class="label" style="" transform="translate(-21.330001831054688, -12.239990234375)"><foreignObject width="42.660003662109375" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Client</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-S1-14" transform="translate(188.24000930786133, 175.89243698120117)"><rect rx="31.980010986328125" ry="31.980010986328125" x="-47.58000564575195" y="-31.980010986328125" width="95.1600112915039" height="63.96002197265625"></rect><g class="label" style="" transform="translate(-32.08500289916992, -24.480010986328125)"><foreignObject width="64.17000579833984" height="48.96002197265625"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>ClusterIP<br>service</span></div></foreignObject></g></g><g class="node default Error Pod" id="flowchart-P2-11" label-offset-y="6.137485168104335" transform="translate(471.8287658691406, 175.89243698120117)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-P3-12" label-offset-y="6.137485168104335" transform="translate(612.5012664794922, 259.83865547180176)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g></g></g></g></g></g></svg></div><p><span>自动注册域名</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><span><span>​</span>x</span></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># cd config/</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># vim mysvc.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: mysvc</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">spec:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  type: ClusterIP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  selector: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#标签选择器</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  app: web &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#标签</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  ports:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> protocol: TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  port: <span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  targetPort: <span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl apply -f mysvc.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl get service</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; TYPE &nbsp; &nbsp; &nbsp;  CLUSTER-IP &nbsp; &nbsp; &nbsp; EXTERNAL-IP &nbsp; PORT(S) &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kubernetes &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.0.1 &nbsp; &nbsp; &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">443</span>/TCP &nbsp; 11d</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysvc &nbsp; &nbsp; &nbsp;  ClusterIP &nbsp; <span class="cm-number">10</span>.245.153.150 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">80</span>/TCP &nbsp;  25s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl -n kube-system get service</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TYPE &nbsp; &nbsp; &nbsp;  CLUSTER-IP &nbsp; &nbsp;  EXTERNAL-IP &nbsp; PORT(S) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kube-dns &nbsp; &nbsp; &nbsp; &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.0.10 &nbsp; &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">53</span>/UDP,53/TCP,9153/TCP &nbsp; 11d</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metrics-server &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.106.12 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">443</span>/TCP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  5d22h</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># yum install -y bind-utils</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># host mysvc.default.svc.cluster.local 10.245.0.10<span class="cm-tab" role="presentation" cm-text="	">  </span>#10.245.0.10是coredns服务的地址</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Using domain server:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Name: <span class="cm-number">10</span>.245.0.10</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Address: <span class="cm-number">10</span>.245.0.10<span class="cm-comment">#53</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Aliases: </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysvc.default.svc.cluster.local has address <span class="cm-number">10</span>.245.153.150</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 756px;"></div><div class="CodeMirror-gutters" style="display: none; height: 756px;"></div></div></div></pre><p><span>创建后端Pod</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">实现server服务的自动跟踪功能</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">没有创建后端pod之前测试，访问service服务地址，失败</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl 10.245.153.150</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-builtin">curl</span>: (7) Failed connect to <span class="cm-number">10</span>.245.153.150:80; Connection refused</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ipvsadm <span class="cm-attribute">-Ln</span> 查看lvs规则</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># ipvsadm -Ln &nbsp;  #后端没有对应的pod</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">IP Virtual Server version <span class="cm-number">1</span>.2.1 <span class="cm-def">(size</span><span class="cm-operator">=</span><span class="cm-number">4096</span>)</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Prot LocalAddress:Port Scheduler Flags</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span>&gt; RemoteAddress:Port &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Forward Weight ActiveConn InActConn</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">... &nbsp; &nbsp; &nbsp; &nbsp;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">TCP &nbsp;<span class="cm-number">10</span>.245.153.150:80 rr</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># vim web.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: Pod</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: myweb</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  labels:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  app: web</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">spec:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  terminationGracePeriodSeconds: <span class="cm-number">0</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  restartPolicy: Always</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  containers:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> name: apache</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  image: registry:5000/myos:httpd</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  imagePullPolicy: IfNotPresent</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  ports:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-attribute">-</span> name: myhttp</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;  protocol: TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;  containerPort: <span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># sed 's,myweb,web1,' web.yaml |kubectl apply -f - </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl 10.245.153.150</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Welcome to The Apache.</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment"># service 靠标签寻找 Pod</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment">#  kubectl label pod web1 app-<span class="cm-tab" role="presentation" cm-text="	">  </span>#删除标签</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl 10.245.153.150</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-builtin">curl</span>: (7) Failed connect to <span class="cm-number">10</span>.245.153.150:80; Connection refused</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl label pod web1 app=web<span class="cm-tab" role="presentation" cm-text="	">    </span>#添加标签</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl 10.245.153.150</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Welcome to The Apache.</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 1031px;"></div><div class="CodeMirror-gutters" style="display: none; height: 1031px;"></div></div></div></pre><p><span>多个Pod负载均衡</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># sed 's,myweb,web2,' web.yaml |kubectl apply -f -</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># sed 's,myweb,web3,' web.yaml |kubectl apply -f -</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#每次出现的结果可能都不一样</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl 10.245.153.150/info.php</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl 10.245.153.150/info.php</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl 10.245.153.150/info.php</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 160px;"></div><div class="CodeMirror-gutters" style="display: none; height: 160px;"></div></div></div></pre><p><span>为服务设置固定IP</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># vim mysvc.yaml </span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: mysvc</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">spec:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  type: ClusterIP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  clusterIP: <span class="cm-number">10</span>.245.1.80 &nbsp; &nbsp; <span class="cm-comment">#设置固定ip</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  selector:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  app: web</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  ports: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#端口转发配置</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> protocol: TCP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#协议</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  port: <span class="cm-number">80</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#用户访问的端口号，即服务监听的端口号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  targetPort: <span class="cm-number">80</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#后端pod监听的端口号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl delete -f mysvc.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl apply -f mysvc.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl get service</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; TYPE &nbsp; &nbsp; &nbsp;  CLUSTER-IP &nbsp;  EXTERNAL-IP &nbsp; PORT(S) &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kubernetes &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.0.1 &nbsp;  &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">443</span>/TCP &nbsp; 11d</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysvc &nbsp; &nbsp; &nbsp;  ClusterIP &nbsp; <span class="cm-number">10</span>.245.1.80 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">80</span>/TCP &nbsp;  30s</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 481px;"></div><div class="CodeMirror-gutters" style="display: none; height: 481px;"></div></div></div></pre><p><span>服务拍错（案例2）</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded md-focus" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap CodeMirror-focused" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 22.9167px; left: 328.917px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre>x</pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="" style="position: relative;"><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#如何使以下服务能够正常运行，并能够正常访问到后端web1，web2，web3的pod服务</span></span></pre></div><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># vim web123.yaml</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: web123</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">spec:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  type: ClusterIP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  clusterIP: <span class="cm-number">192</span>.168.1.88</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  selector: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  app: apache &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  ports:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> protocol: TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  port: <span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  targetPort: web</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 367px;"></div><div class="CodeMirror-gutters" style="display: none; height: 367px;"></div></div></div></pre><h3><a name="nodeport" class="md-header-anchor"></a><span>NodePort</span></h3><div class="md-diagram-panel"><svg id="mermaidChart1" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="423.53863525390625" style="max-width: 620.237px; height: 463.539px;" viewBox="0 0 620.2374877929688 423.53863525390625" class="md-require-zoom-fix"><style>#mermaidChart1{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:11.111110669595242px;fill:#333333;}#mermaidChart1 .error-icon{fill:hsl(60,100%,100%);}#mermaidChart1 .error-text{fill:rgb(0,0,0);stroke:rgb(0,0,0);}#mermaidChart1 .edge-thickness-normal{stroke-width:2px;}#mermaidChart1 .edge-thickness-thick{stroke-width:3.5px;}#mermaidChart1 .edge-pattern-solid{stroke-dasharray:0;}#mermaidChart1 .edge-pattern-dashed{stroke-dasharray:3;}#mermaidChart1 .edge-pattern-dotted{stroke-dasharray:2;}#mermaidChart1 .marker{fill:#000000;}#mermaidChart1 .marker.cross{stroke:#000000;}#mermaidChart1 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:11.111110669595242px;}#mermaidChart1 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaidChart1 .label text{fill:#333;}#mermaidChart1 .node rect,#mermaidChart1 .node circle,#mermaidChart1 .node ellipse,#mermaidChart1 .node polygon,#mermaidChart1 .node path{fill:#ECECFF;stroke:hsl(240,60%,86.2745098039%);stroke-width:1px;}#mermaidChart1 .node .label{text-align:center;}#mermaidChart1 .node.clickable{cursor:pointer;}#mermaidChart1 .arrowheadPath{fill:undefined;}#mermaidChart1 .edgePath .path{stroke:#000000;stroke-width:1.5px;}#mermaidChart1 .flowchart-link{stroke:#000000;fill:none;}#mermaidChart1 .edgeLabel{background-color:#f4f4f4;text-align:center;}#mermaidChart1 .edgeLabel rect{opacity:0.5;background-color:#f4f4f4;fill:#f4f4f4;}#mermaidChart1 .cluster rect{fill:hsl(60,100%,100%);stroke:hsl(60,60%,90%);stroke-width:1px;}#mermaidChart1 .cluster text{fill:rgb(0,0,0);}#mermaidChart1 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(60,100%,100%);border:1px solid undefined;border-radius:2px;pointer-events:none;z-index:100;}#mermaidChart1:root{--mermaid-font-family:sans-serif;}#mermaidChart1:root{--mermaid-alt-font-family:sans-serif;}#mermaidChart1 .Cluster &gt; *{fill:#ffffc0 !important;color:#ff00ff !important;stroke-width:4px !important;}#mermaidChart1 .Cluster tspan{fill:#ff00ff !important;}#mermaidChart1 .Node &gt; *{fill:#a5a5f0 !important;color:#f0f0f0 !important;stroke:#f06080 !important;stroke-width:3px !important;}#mermaidChart1 .Node tspan{fill:#f0f0f0 !important;}#mermaidChart1 .Pod &gt; *{fill:#ccffbb !important;color:#000000 !important;stroke-width:3px !important;}#mermaidChart1 .Pod tspan{fill:#000000 !important;}#mermaidChart1 .User &gt; *{fill:#ccddee !important;color:#000000 !important;stroke:#555555 !important;stroke-width:3px !important;}#mermaidChart1 .User tspan{fill:#000000 !important;}#mermaidChart1 flowchart-v2{fill:apa;}</style><g transform="translate(0, 2)"><marker id="flowchart-pointEnd" class="marker flowchart" viewBox="0 0 10 10" refX="9" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-pointStart" class="marker flowchart" viewBox="0 0 10 10" refX="0" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-circleEnd" class="marker flowchart" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="flowchart-circleStart" class="marker flowchart" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="flowchart-crossEnd" class="marker cross flowchart" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-crossStart" class="marker cross flowchart" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><g class="root"><g class="clusters"><g class="cluster Cluster" id="C1"><rect rx="0" ry="0" x="165.66000366210938" y="8" width="446.5774841308594" height="405.53860664367676"></rect><g class="cluster-label" transform="translate(350.4962463378906, 6)"><foreignObject width="76.90499877929688" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>k8s cluster</span></div></foreignObject></g></g></g><g class="edgePaths"><path d="M245.23374938964844,62.739990234375L258.4960403442383,62.739990234375C271.7583312988281,62.739990234375,298.2829132080078,62.739990234375,321.13289361847274,82.08154567082723C343.98287402893766,101.42310110727946,363.1582529406878,140.10621198018393,372.7459423965629,159.44776741663614L382.333631852438,178.78932285308838" id="L-N1-S1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-N1 LE-S1" style="fill:none;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M245.23374938964844,210.76930332183838L258.4960403442383,210.76930332183838C271.7583312988281,210.76930332183838,298.2829132080078,210.76930332183838,315.71187082926434,210.76930332183838C333.1408284505208,210.76930332183838,341.4741617838542,210.76930332183838,345.6408284505208,210.76930332183838L349.8074951171875,210.76930332183838" id="L-N2-S1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-N2 LE-S1" style="fill:none;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M245.23374938964844,358.79861640930176L258.4960403442383,358.79861640930176C271.7583312988281,358.79861640930176,298.2829132080078,358.79861640930176,321.13289361847274,339.45706097284955C343.98287402893766,320.1155055363973,363.1582529406878,281.43239466349286,372.7459423965629,262.0908392270406L382.333631852438,242.74928379058838" id="L-N3-S1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-N3 LE-S1" style="fill:none;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M415.09013626072147,178.78932285308838L424.50261141437073,160.98213879267374C433.91508656802006,143.17495473225912,452.7400368753186,107.56058661142985,466.31917869563455,89.75340255101521C479.8983205159505,71.94621849060059,488.2316538492839,71.94621849060059,496.5649871826172,71.94621849060059C504.8983205159505,71.94621849060059,513.2316538492838,71.94621849060059,521.5649871826172,71.94621849060059C529.8983205159506,71.94621849060059,538.2316538492838,71.94621849060059,542.3983205159506,71.94621849060059L546.5649871826172,71.94621849060059" id="L-S1-P1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S1 LE-P1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M446.5649871826172,210.76930332183838L450.7316538492839,210.76930332183838C454.8983205159505,210.76930332183838,463.2316538492839,210.76930332183838,471.5649871826172,210.76930332183838C479.8983205159505,210.76930332183838,488.2316538492839,210.76930332183838,496.5649871826172,210.76930332183838C504.8983205159505,210.76930332183838,513.2316538492838,210.76930332183838,521.5649871826172,210.76930332183838C529.8983205159506,210.76930332183838,538.2316538492838,210.76930332183838,542.3983205159506,210.76930332183838L546.5649871826172,210.76930332183838" id="L-S1-P2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S1 LE-P2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M415.09013626072147,242.74928379058838L424.50261141437073,260.556467851003C433.91508656802006,278.36365191141766,452.7400368753186,313.9780200322469,466.31917869563455,331.78520409266156C479.8983205159505,349.5923881530762,488.2316538492839,349.5923881530762,496.5649871826172,349.5923881530762C504.8983205159505,349.5923881530762,513.2316538492838,349.5923881530762,521.5649871826172,349.5923881530762C529.8983205159506,349.5923881530762,538.2316538492838,349.5923881530762,542.3983205159506,349.5923881530762L546.5649871826172,349.5923881530762" id="L-S1-P3" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S1 LE-P3" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M46.68264260135674,183.67512543377543L54.012202778148854,163.51926956720868C61.341762954940954,143.36341370064196,76.00088330852516,103.05170196750846,87.49711015198393,82.89584610094174C98.9933369954427,62.739990234375,107.32667032877605,62.739990234375,115.66000366210938,62.739990234375C123.9933369954427,62.739990234375,132.32667032877603,62.739990234375,140.66000366210938,62.739990234375C148.99333699544272,62.739990234375,157.32667032877603,62.739990234375,174.75562795003256,62.739990234375C192.18458557128906,62.739990234375,218.70916748046875,62.739990234375,231.9714584350586,62.739990234375L245.23374938964844,62.739990234375" id="L-User-N1" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-User LE-N1" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M65.66000366210938,210.76930332183838L69.82667032877605,210.76930332183838C73.9933369954427,210.76930332183838,82.32667032877605,210.76930332183838,90.66000366210938,210.76930332183838C98.9933369954427,210.76930332183838,107.32667032877605,210.76930332183838,115.66000366210938,210.76930332183838C123.9933369954427,210.76930332183838,132.32667032877603,210.76930332183838,140.66000366210938,210.76930332183838C148.99333699544272,210.76930332183838,157.32667032877603,210.76930332183838,174.75562795003256,210.76930332183838C192.18458557128906,210.76930332183838,218.70916748046875,210.76930332183838,231.9714584350586,210.76930332183838L245.23374938964844,210.76930332183838" id="L-User-N2" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-User LE-N2" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path><path d="M46.68264260135674,237.86348120990132L54.012202778148854,258.01933707646805C61.341762954940954,278.1751929430348,76.00088330852516,318.4869046761683,87.49711015198393,338.642760542735C98.9933369954427,358.79861640930176,107.32667032877605,358.79861640930176,115.66000366210938,358.79861640930176C123.9933369954427,358.79861640930176,132.32667032877603,358.79861640930176,140.66000366210938,358.79861640930176C148.99333699544272,358.79861640930176,157.32667032877603,358.79861640930176,174.75562795003256,358.79861640930176C192.18458557128906,358.79861640930176,218.70916748046875,358.79861640930176,231.9714584350586,358.79861640930176L245.23374938964844,358.79861640930176" id="L-User-N3" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-User LE-N3" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-start="url(#flowchart-circleStart)" marker-end="url(#flowchart-circleEnd)"></path></g><g class="edgeLabels"><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g></g><g class="nodes"><g class="node default Pod" id="flowchart-S1-39" transform="translate(398.18624114990234, 210.76930332183838)"><rect rx="31.97998046875" ry="31.97998046875" x="-48.378746032714844" y="-31.97998046875" width="96.75749206542969" height="63.9599609375"></rect><g class="label" style="" transform="translate(-32.883750915527344, -24.47998046875)"><foreignObject width="65.76750183105469" height="48.9599609375"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>NodePort<br>service</span></div></foreignObject></g></g><g class="node default Node" id="flowchart-N1-36" transform="translate(245.23374938964844, 62.739990234375)"><polygon points="9.8699951171875,0 99.27749633789062,0 109.14749145507812,-19.739990234375 99.27749633789062,-39.47998046875 9.8699951171875,-39.47998046875 0,-19.739990234375" class="label-container" transform="translate(-54.57374572753906,19.739990234375)"></polygon><g class="label" style="" transform="translate(-37.20375061035156, -12.239990234375)"><foreignObject width="74.40750122070312" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>node-0001</span></div></foreignObject></g></g><g class="node default Node" id="flowchart-N2-37" transform="translate(245.23374938964844, 210.76930332183838)"><polygon points="9.8699951171875,0 99.27749633789062,0 109.14749145507812,-19.739990234375 99.27749633789062,-39.47998046875 9.8699951171875,-39.47998046875 0,-19.739990234375" class="label-container" transform="translate(-54.57374572753906,19.739990234375)"></polygon><g class="label" style="" transform="translate(-37.20375061035156, -12.239990234375)"><foreignObject width="74.40750122070312" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>node-0002</span></div></foreignObject></g></g><g class="node default Node" id="flowchart-N3-38" transform="translate(245.23374938964844, 358.79861640930176)"><polygon points="9.8699951171875,0 99.27749633789062,0 109.14749145507812,-19.739990234375 99.27749633789062,-39.47998046875 9.8699951171875,-39.47998046875 0,-19.739990234375" class="label-container" transform="translate(-54.57374572753906,19.739990234375)"></polygon><g class="label" style="" transform="translate(-37.20375061035156, -12.239990234375)"><foreignObject width="74.40750122070312" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>node-0003</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-P1-41" label-offset-y="6.137485168104335" transform="translate(566.901237487793, 71.94621849060059)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-P2-42" label-offset-y="6.137485168104335" transform="translate(566.901237487793, 210.76930332183838)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-P3-43" label-offset-y="6.137485168104335" transform="translate(566.901237487793, 349.5923881530762)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default User" id="flowchart-User-44" transform="translate(36.83000183105469, 210.76930332183838)"><circle rx="0" ry="0" r="28.830001831054688" width="57.660003662109375" height="39.47998046875"></circle><g class="label" style="" transform="translate(-21.330001831054688, -12.239990234375)"><foreignObject width="42.660003662109375" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Client</span></div></foreignObject></g></g></g></g></g></svg></div><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ClusterIP只能在集群内部方式，外部是无法访问集群内部资源的</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">[root@ecs-proxy ~]<span class="cm-comment"># curl 10.245.1.80<span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span>#访问失败</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">使用NodePort发布服务，执行其端口为30080</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># vim mysvc.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: mysvc</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">spec:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  type: NodePort &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#指定服务类型</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  clusterIP: <span class="cm-number">10</span>.245.1.80</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  selector:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  app: web</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  ports:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> protocol: TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  port: <span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  nodePort: <span class="cm-number">30080</span> &nbsp; &nbsp; &nbsp; <span class="cm-comment">#指定端口，不指定就使用随机端口</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  targetPort: <span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># kubectl apply -f mysvc.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl get service</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; TYPE &nbsp; &nbsp; &nbsp;  CLUSTER-IP &nbsp;  EXTERNAL-IP &nbsp; PORT(S) &nbsp; &nbsp; &nbsp;  AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kubernetes &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.0.1 &nbsp;  &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">443</span>/TCP &nbsp; &nbsp; &nbsp;  11d</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysvc &nbsp; &nbsp; &nbsp;  NodePort &nbsp; &nbsp;<span class="cm-number">10</span>.245.1.80 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">80</span>:30080/TCP &nbsp; 27m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">web123 &nbsp; &nbsp; &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.1.88 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">80</span>/TCP &nbsp; &nbsp; &nbsp; &nbsp; 19m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">使用集群外的节点跳板机测试：访问任意节点的30080端口即可</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@ecs-proxy ~]<span class="cm-comment">#  curl 192.168.1.51:30080</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Welcome to The Apache.</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@ecs-proxy ~]<span class="cm-comment">#  curl 192.168.1.52:30080</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Welcome to The Apache.</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@ecs-proxy ~]<span class="cm-comment">#  curl 192.168.1.53:30080</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Welcome to The Apache.</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 802px;"></div><div class="CodeMirror-gutters" style="display: none; height: 802px;"></div></div></div></pre><h3><a name="ingress" class="md-header-anchor"></a><span>Ingress</span></h3><div class="md-diagram-panel"><svg id="mermaidChart2" width="100%" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" height="469.5697326660156" style="max-width: 621.81px; height: 509.57px;" viewBox="0 0 621.8099365234375 469.5697326660156" class="md-require-zoom-fix"><style>#mermaidChart2{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:11.111110669595242px;fill:#333333;}#mermaidChart2 .error-icon{fill:hsl(60,100%,100%);}#mermaidChart2 .error-text{fill:rgb(0,0,0);stroke:rgb(0,0,0);}#mermaidChart2 .edge-thickness-normal{stroke-width:2px;}#mermaidChart2 .edge-thickness-thick{stroke-width:3.5px;}#mermaidChart2 .edge-pattern-solid{stroke-dasharray:0;}#mermaidChart2 .edge-pattern-dashed{stroke-dasharray:3;}#mermaidChart2 .edge-pattern-dotted{stroke-dasharray:2;}#mermaidChart2 .marker{fill:#000000;}#mermaidChart2 .marker.cross{stroke:#000000;}#mermaidChart2 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:11.111110669595242px;}#mermaidChart2 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaidChart2 .label text{fill:#333;}#mermaidChart2 .node rect,#mermaidChart2 .node circle,#mermaidChart2 .node ellipse,#mermaidChart2 .node polygon,#mermaidChart2 .node path{fill:#ECECFF;stroke:hsl(240,60%,86.2745098039%);stroke-width:1px;}#mermaidChart2 .node .label{text-align:center;}#mermaidChart2 .node.clickable{cursor:pointer;}#mermaidChart2 .arrowheadPath{fill:undefined;}#mermaidChart2 .edgePath .path{stroke:#000000;stroke-width:1.5px;}#mermaidChart2 .flowchart-link{stroke:#000000;fill:none;}#mermaidChart2 .edgeLabel{background-color:#f4f4f4;text-align:center;}#mermaidChart2 .edgeLabel rect{opacity:0.5;background-color:#f4f4f4;fill:#f4f4f4;}#mermaidChart2 .cluster rect{fill:hsl(60,100%,100%);stroke:hsl(60,60%,90%);stroke-width:1px;}#mermaidChart2 .cluster text{fill:rgb(0,0,0);}#mermaidChart2 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(60,100%,100%);border:1px solid undefined;border-radius:2px;pointer-events:none;z-index:100;}#mermaidChart2:root{--mermaid-font-family:sans-serif;}#mermaidChart2:root{--mermaid-alt-font-family:sans-serif;}#mermaidChart2 .U &gt; *{fill:#ccddee !important;color:#000000 !important;stroke:#555555 !important;stroke-width:3px !important;}#mermaidChart2 .U tspan{fill:#000000 !important;}#mermaidChart2 .k8s &gt; *{fill:#ffffc0 !important;color:#ff00ff !important;stroke-width:4px !important;}#mermaidChart2 .k8s tspan{fill:#ff00ff !important;}#mermaidChart2 .Ingress &gt; *{fill:#0000ff !important;color:#ffff00 !important;stroke:#f000f0 !important;stroke-width:2px !important;}#mermaidChart2 .Ingress tspan{fill:#ffff00 !important;}#mermaidChart2 .Pod &gt; *{fill:#ccffbb !important;color:#000000 !important;stroke-width:2px !important;}#mermaidChart2 .Pod tspan{fill:#000000 !important;}#mermaidChart2 flowchart-v2{fill:apa;}</style><g transform="translate(0, 2)"><marker id="flowchart-pointEnd" class="marker flowchart" viewBox="0 0 10 10" refX="9" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 0 L 10 5 L 0 10 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-pointStart" class="marker flowchart" viewBox="0 0 10 10" refX="0" refY="5" markerUnits="userSpaceOnUse" markerWidth="12" markerHeight="12" orient="auto"><path d="M 0 5 L 10 10 L 10 0 z" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-circleEnd" class="marker flowchart" viewBox="0 0 10 10" refX="11" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="flowchart-circleStart" class="marker flowchart" viewBox="0 0 10 10" refX="-1" refY="5" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><circle cx="5" cy="5" r="5" class="arrowMarkerPath" style="stroke-width: 1; stroke-dasharray: 1, 0;"></circle></marker><marker id="flowchart-crossEnd" class="marker cross flowchart" viewBox="0 0 11 11" refX="12" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><marker id="flowchart-crossStart" class="marker cross flowchart" viewBox="0 0 11 11" refX="-1" refY="5.2" markerUnits="userSpaceOnUse" markerWidth="11" markerHeight="11" orient="auto"><path d="M 1,1 l 9,9 M 10,1 l -9,9" class="arrowMarkerPath" style="stroke-width: 2; stroke-dasharray: 1, 0;"></path></marker><g class="root"><g class="clusters"><g class="cluster k8s" id="X"><rect rx="0" ry="0" x="235.15750122070312" y="8" width="378.6524887084961" height="451.5697479248047"></rect><g class="cluster-label" transform="translate(357.33249282836914, 6)"><foreignObject width="134.30250549316406" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Kubernetes cluster</span></div></foreignObject></g></g></g><g class="edgePaths"><path d="M483.4004785955341,106.15244674682617L490.0233137160863,100.4514087041219C496.6461488366386,94.75037066141765,509.8918190777431,83.34829457600911,520.681320864962,77.64725653330485C531.470822652181,71.94621849060059,539.8041559855143,71.94621849060059,543.970822652181,71.94621849060059L548.1374893188477,71.94621849060059" id="L-S1-P11" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S1 LE-P11" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M483.4004785955341,145.63242721557617L490.0233137160863,151.33346525828043C496.6461488366386,157.0345033009847,509.8918190777431,168.43657938639322,520.681320864962,174.1376174290975C531.470822652181,179.83865547180176,539.8041559855143,179.83865547180176,543.970822652181,179.83865547180176L548.1374893188477,179.83865547180176" id="L-S1-P12" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S1 LE-P12" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M483.4004785955341,321.9373207092285L490.0233137160863,316.23628266652423C496.6461488366386,310.53524462382,509.8918190777431,299.13316853841144,520.681320864962,293.4321304957072C531.470822652181,287.73109245300293,539.8041559855143,287.73109245300293,543.970822652181,287.73109245300293L548.1374893188477,287.73109245300293" id="L-S2-P21" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S2 LE-P21" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M483.4004785955341,361.4173011779785L490.0233137160863,367.1183392206828C496.6461488366386,372.819377263387,509.8918190777431,384.2214533487956,520.681320864962,389.9224913914998C531.470822652181,395.6235294342041,539.8041559855143,395.6235294342041,543.970822652181,395.6235294342041L548.1374893188477,395.6235294342041" id="L-S2-P22" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-S2 LE-P22" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M312.04102627952494,214.04488372802734L323.11481282876264,199.352809270223C334.18859937800033,184.6607348124186,356.3361724764757,155.2765858968099,374.7960006669488,140.58451143900552C393.2558288574219,125.89243698120117,408.0279121398926,125.89243698120117,415.41395378112793,125.89243698120117L422.7999954223633,125.89243698120117" id="L-I-S1" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-I LE-S1" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M312.04102627952494,253.52486419677734L323.11481282876264,268.2169386545817C334.18859937800033,282.90901311238605,356.3361724764757,312.2931620279948,374.7960006669488,326.98523648579913C393.2558288574219,341.6773109436035,408.0279121398926,341.6773109436035,415.41395378112793,341.6773109436035L422.7999954223633,341.6773109436035" id="L-I-S2" class=" edge-thickness-normal edge-pattern-solid flowchart-link LS-I LE-S2" style="fill:none;" marker-end="url(#flowchart-pointEnd)"></path><path d="M65.66000366210938,233.78487396240234L79.78479512532552,233.78487396240234C93.90958658854167,233.78487396240234,122.15916951497395,233.78487396240234,150.40875244140625,233.78487396240234C178.65833536783853,233.78487396240234,206.90791829427084,233.78487396240234,225.19937642415366,233.78487396240234C243.49083455403647,233.78487396240234,251.82416788736978,233.78487396240234,255.99083455403647,233.78487396240234L260.1575012207031,233.78487396240234" id="L-C-I" class=" edge-thickness-normal edge-pattern-dotted flowchart-link LS-C LE-I" style="fill:none;stroke-width:2px;stroke-dasharray:3;" marker-end="url(#flowchart-pointEnd)"></path></g><g class="edgeLabels"><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel"><g class="label" transform="translate(0, 0)"><foreignObject width="0" height="0"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span></span></div></foreignObject></g></g><g class="edgeLabel" transform="translate(378.4837455749512, 125.89243698120117)"><g class="label" transform="translate(-19.31624984741211, -24.47998046875)"><foreignObject width="38.63249969482422" height="48.9599609375"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>route<br>rule</span></div></foreignObject></g></g><g class="edgeLabel" transform="translate(378.4837455749512, 341.6773109436035)"><g class="label" transform="translate(-19.31624984741211, -24.47998046875)"><foreignObject width="38.63249969482422" height="48.9599609375"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>route<br>rule</span></div></foreignObject></g></g><g class="edgeLabel" transform="translate(150.40875244140625, 233.78487396240234)"><g class="label" transform="translate(-59.748748779296875, -24.47998046875)"><foreignObject width="119.49749755859375" height="48.9599609375"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Ingress-managed<br>load balancer</span></div></foreignObject></g></g></g><g class="nodes"><g class="node default Pod" id="flowchart-P11-61" label-offset-y="6.137485168104335" transform="translate(568.4737396240234, 71.94621849060059)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-P12-62" label-offset-y="6.137485168104335" transform="translate(568.4737396240234, 179.83865547180176)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-S1-60" transform="translate(460.46874237060547, 125.89243698120117)"><rect rx="19.739990234375" ry="19.739990234375" x="-37.66874694824219" y="-19.739990234375" width="75.33749389648438" height="39.47998046875"></rect><g class="label" style="" transform="translate(-25.233749389648438, -12.239990234375)"><foreignObject width="50.467498779296875" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>service</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-P21-64" label-offset-y="6.137485168104335" transform="translate(568.4737396240234, 287.73109245300293)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-P22-65" label-offset-y="6.137485168104335" transform="translate(568.4737396240234, 395.6235294342041)"><path d="M 0,6.137485168104335 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 a 20.33625030517578,6.137485168104335 0,0,0 -40.67250061035156 0 l 0,45.617465636854334 a 20.33625030517578,6.137485168104335 0,0,0 40.67250061035156 0 l 0,-45.617465636854334" transform="translate(-20.33625030517578,-28.9462179865315)"></path><g class="label" style="" transform="translate(-12.836250305175781, -12.239990234375)"><foreignObject width="25.672500610351562" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Pod</span></div></foreignObject></g></g><g class="node default Pod" id="flowchart-S2-63" transform="translate(460.46874237060547, 341.6773109436035)"><rect rx="19.739990234375" ry="19.739990234375" x="-37.66874694824219" y="-19.739990234375" width="75.33749389648438" height="39.47998046875"></rect><g class="label" style="" transform="translate(-25.233749389648438, -12.239990234375)"><foreignObject width="50.467498779296875" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>service</span></div></foreignObject></g></g><g class="node default Ingress" id="flowchart-I-66" transform="translate(297.1624984741211, 233.78487396240234)"><rect rx="19.739990234375" ry="19.739990234375" x="-37.00499725341797" y="-19.739990234375" width="74.00999450683594" height="39.47998046875"></rect><g class="label" style="" transform="translate(-24.56999969482422, -12.239990234375)"><foreignObject width="49.13999938964844" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Ingress</span></div></foreignObject></g></g><g class="node default U" id="flowchart-C-69" transform="translate(36.83000183105469, 233.78487396240234)"><circle rx="0" ry="0" r="28.830001831054688" width="57.660003662109375" height="39.47998046875"></circle><g class="label" style="" transform="translate(-21.330001831054688, -12.239990234375)"><foreignObject width="42.660003662109375" height="24.47998046875"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; white-space: nowrap;"><span>Client</span></div></foreignObject></g></g></g></g></g></svg></div><h4><a name="安装控制器ingress" class="md-header-anchor"></a><span>安装控制器ingress</span></h4><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ingress：控制器，规则定义</span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># cd /root/plugins/ingress/</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># docker load -i ingress.tar.xz</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># docker tag  k8s.gcr.io/ingress-nginx/controller:v1.1.0 registry:5000/controller:v1.1.0</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># docker push registry:5000/controller:v1.1.0</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># docker tag k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.1.1 registry:5000/kube-webhook-certgen:v1.1.1</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># docker push registry:5000/kube-webhook-certgen:v1.1.1</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># vim deploy.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">328</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image: registry:5000/controller:v1.1.0</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">609</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image: registry:5000/kube-webhook-certgen:v1.1.1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-number">661</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image: registry:5000/kube-webhook-certgen:v1.1.1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># kubectl apply -f deploy.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># kubectl -n ingress-nginx get pod</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  READY &nbsp; STATUS &nbsp; &nbsp;  RESTARTS &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ingress-nginx-admission-create--1-bzpsv &nbsp; &nbsp; <span class="cm-number">0</span>/1 &nbsp; &nbsp; Completed &nbsp; <span class="cm-number">0</span> &nbsp; &nbsp; &nbsp; &nbsp;  25s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ingress-nginx-admission-patch--1-pml7b &nbsp; &nbsp; &nbsp;<span class="cm-number">0</span>/1 &nbsp; &nbsp; Completed &nbsp; <span class="cm-number">1</span> &nbsp; &nbsp; &nbsp; &nbsp;  25s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ingress-nginx-controller-79b888f6c7-ztfct &nbsp; <span class="cm-number">1</span>/1 &nbsp; &nbsp; Running &nbsp; &nbsp; <span class="cm-number">0</span> &nbsp; &nbsp; &nbsp; &nbsp;  25s</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 504px;"></div><div class="CodeMirror-gutters" style="display: none; height: 504px;"></div></div></div></pre><h4><a name="创建后端服务" class="md-header-anchor"></a><span>创建后端服务</span></h4><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ingress]<span class="cm-comment"># cd /root/config/</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># vim mysvc.yaml &nbsp; #服务类型改为ClusterIP，nodePort删除</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: mysvc</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">spec:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  type: ClusterIP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#指定服务类型</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  clusterIP: <span class="cm-number">10</span>.245.1.80</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  selector:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  app: web</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  ports:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> protocol: TCP</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  port: <span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  targetPort: <span class="cm-number">80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl apply -f mysvc.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl get service</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; TYPE &nbsp; &nbsp; &nbsp;  CLUSTER-IP &nbsp;  EXTERNAL-IP &nbsp; PORT(S) &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kubernetes &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.0.1 &nbsp;  &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">443</span>/TCP &nbsp; 11d</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mysvc &nbsp; &nbsp; &nbsp;  ClusterIP &nbsp; <span class="cm-number">10</span>.245.1.80 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">80</span>/TCP &nbsp;  61m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">web123 &nbsp; &nbsp; &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.1.88 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">80</span>/TCP &nbsp;  54m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl get pods --show-labels </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; READY &nbsp; STATUS &nbsp;  RESTARTS &nbsp; AGE &nbsp; LABELS</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">web1 &nbsp; <span class="cm-number">1</span>/1 &nbsp; &nbsp; Running &nbsp; <span class="cm-number">0</span> &nbsp; &nbsp; &nbsp; &nbsp;  67m &nbsp; <span class="cm-def">app</span><span class="cm-operator">=</span>web</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">web2 &nbsp; <span class="cm-number">1</span>/1 &nbsp; &nbsp; Running &nbsp; <span class="cm-number">0</span> &nbsp; &nbsp; &nbsp; &nbsp;  59m &nbsp; <span class="cm-def">app</span><span class="cm-operator">=</span>web</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">web3 &nbsp; <span class="cm-number">1</span>/1 &nbsp; &nbsp; Running &nbsp; <span class="cm-number">0</span> &nbsp; &nbsp; &nbsp; &nbsp;  59m &nbsp; <span class="cm-def">app</span><span class="cm-operator">=</span>web</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl 10.245.1.80</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Welcome to The Apache.</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 665px;"></div><div class="CodeMirror-gutters" style="display: none; height: 665px;"></div></div></div></pre><h4><a name="对外发布服务" class="md-header-anchor"></a><span>对外发布服务</span></h4><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-comment">#查看控制器</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master ~]<span class="cm-comment"># kubectl get ingressclasses.networking.k8s.io </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp;  CONTROLLER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PARAMETERS &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">nginx &nbsp; k8s.io/ingress-nginx &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; 5m7s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># vim mying.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: Ingress &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#资源对象类型</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: networking.k8s.io/v1 &nbsp;<span class="cm-comment">#版本</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#元数据</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: mying &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#名字</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">spec:<span class="cm-tab" role="presentation" cm-text="	">   </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span><span class="cm-tab" role="presentation" cm-text="	">    </span> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#详细信息</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  ingressClassName: nginx &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#使用的类名称，使用的控制器是哪个</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  rules: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#ingress规则定义</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> host: nsd.tedu.cn &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#域名定义</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;  http: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#协议</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;  paths: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#访问的路径定义</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;<span class="cm-attribute">-</span> backend: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#后端服务</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-builtin">service</span>: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#服务声明</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  name: mysvc &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#服务名称</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  port: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#端口号声明</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  number: <span class="cm-number">80</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#访问服务的端口号</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  path: / &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#url路径</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp; &nbsp;  pathType: Prefix &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#路径类型Prefix基于以 / 分隔的 URL 路径前缀匹配,Extact,ImplementationSpecific</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl apply -f mying.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># kubectl get ingress</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp;  CLASS &nbsp; HOSTS &nbsp; &nbsp; &nbsp; &nbsp; ADDRESS &nbsp; &nbsp; &nbsp;  PORTS &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">mying &nbsp; nginx &nbsp; nsd.tedu.cn &nbsp; <span class="cm-number">192</span>.168.1.52 &nbsp; <span class="cm-number">80</span> &nbsp; &nbsp;  92s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">测试：</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">-H</span> 参数用于指定 HTTP 请求头在这里Host: nsd.tedu.cn 表示将 Host 请求头设置为 nsd.tedu.cn</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># curl -H "Host: nsd.tedu.cn" http://192.168.1.52</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Welcome to The Apache.</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 779px;"></div><div class="CodeMirror-gutters" style="display: none; height: 779px;"></div></div></div></pre><h2><a name="web管理插件" class="md-header-anchor"></a><span>web管理插件</span></h2><h3><a name="安装dashboard" class="md-header-anchor"></a><span>安装Dashboard</span></h3><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master config]<span class="cm-comment"># cd /root/plugins/dashboard/</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># docker load -i dashboard.tar.xz </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># docker tag kubernetesui/dashboard:v2.4.0 registry:5000/dashboard:v2.4.0</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># docker push registry:5000/dashboard:v2.4.0</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># docker tag kubernetesui/metrics-scraper:v1.0.7  registry:5000/metrics-scraper:v1.0.7</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># docker push registry:5000/metrics-scraper:v1.0.7</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># vim recommended.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">...</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">30</span> <span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">31</span> </span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">32</span> kind: Service</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">33</span> apiVersion: v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">34</span> metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">35</span> &nbsp; labels:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">36</span> &nbsp; &nbsp; k8s-app: kubernetes-dashboard</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">37</span> &nbsp; name: kubernetes-dashboard</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">38</span> &nbsp; namespace: kubernetes-dashboard</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">39</span> spec:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">40</span> &nbsp; type: NodePort &nbsp; <span class="cm-comment">#新添加，使用NodePort发布服务，默认是ClutserIP</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">41</span> &nbsp; ports:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">42</span> &nbsp; &nbsp; <span class="cm-attribute">-</span> port: <span class="cm-number">443</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">43</span> &nbsp; &nbsp; &nbsp; nodePort: <span class="cm-number">30443</span> &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#新添加，否则端口随机产生</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">44</span> &nbsp; &nbsp; &nbsp; targetPort: <span class="cm-number">8443</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> ...</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">192</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image: registry:5000/dashboard:v2.4.0</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> <span class="cm-number">277</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image: registry:5000/metrics-scraper:v1.0.7</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> ...</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl apply -f recommended.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl -n kubernetes-dashboard get pods</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; READY &nbsp; STATUS &nbsp;  RESTARTS &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">dashboard-metrics-scraper-767f484b48-zshs7 &nbsp; <span class="cm-number">1</span>/1 &nbsp; &nbsp; Running &nbsp; <span class="cm-number">0</span> &nbsp; &nbsp; &nbsp; &nbsp;  13s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kubernetes-dashboard-6bd6657cb8-tm9k2 &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">1</span>/1 &nbsp; &nbsp; Running &nbsp; <span class="cm-number">0</span> &nbsp; &nbsp; &nbsp; &nbsp;  13s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl -n kubernetes-dashboard get service</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  TYPE &nbsp; &nbsp; &nbsp;  CLUSTER-IP &nbsp; &nbsp;  EXTERNAL-IP &nbsp; PORT(S) &nbsp; &nbsp; &nbsp; &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">dashboard-metrics-scraper &nbsp; ClusterIP &nbsp; <span class="cm-number">10</span>.245.122.22 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">8000</span>/TCP &nbsp; &nbsp; &nbsp;  44s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kubernetes-dashboard &nbsp; &nbsp; &nbsp;  NodePort &nbsp; &nbsp;<span class="cm-number">10</span>.245.118.60 &nbsp; &lt;none&gt; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">443</span>:30443/TCP &nbsp; 44s</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 894px;"></div><div class="CodeMirror-gutters" style="display: none; height: 894px;"></div></div></div></pre><h3><a name="浏览器访问-dashboard" class="md-header-anchor"></a><span>浏览器访问 Dashboard</span></h3><p><span>通过浏览器访问 Dashboard 登录页面，ELB发布</span></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021205407.png" referrerpolicy="no-referrer" alt="image-20230625021205407"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021344821.png" referrerpolicy="no-referrer" alt="image-20230625021344821"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021520963.png" referrerpolicy="no-referrer" alt="image-20230625021520963"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021602644.png" referrerpolicy="no-referrer" alt="image-20230625021602644"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021622305.png" referrerpolicy="no-referrer" alt="image-20230625021622305"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021647506.png" referrerpolicy="no-referrer" alt="image-20230625021647506"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021701743.png" referrerpolicy="no-referrer" alt="image-20230625021701743"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021727202.png" referrerpolicy="no-referrer" alt="image-20230625021727202"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021751887.png" referrerpolicy="no-referrer" alt="image-20230625021751887"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021819760.png" referrerpolicy="no-referrer" alt="image-20230625021819760"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021839939.png" referrerpolicy="no-referrer" alt="image-20230625021839939"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021852998.png" referrerpolicy="no-referrer" alt="image-20230625021852998"></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625021906338.png" referrerpolicy="no-referrer" alt="image-20230625021906338"></p><p><span>使用负载均衡的ip:30443访问： https://负载均衡ip:30443</span></p><p><span>如果使用谷歌访问，点击高级之后，出现不让访问，点击页面空白处回车，盲敲thisisunsafe即可</span></p><p><img src="../CLOUD1/cloud_01.assets/image-20230625022229912.png" referrerpolicy="no-referrer" alt="image-20230625022229912"></p><p><span>此时需要登录才行，需要有能够登录的账号</span></p><h2><a name="服务账号与权限" class="md-header-anchor"></a><span>服务账号与权限</span></h2><h3><a name="serviceaccount" class="md-header-anchor"></a><span>serviceaccount</span></h3><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl get serviceaccounts <span class="cm-tab" role="presentation" cm-text="	">   </span>#默认名称空间中的账号</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl -n kube-system get serviceaccounts </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">使用资源对象文件创建服务账号，给dashboard使用</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># vim user.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: ServiceAccount</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: dashboard-admin</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  namespace: kubernetes-dashboard</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl apply -f user.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl -n kubernetes-dashboard get serviceaccounts </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SECRETS &nbsp; AGE</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">dashboard-admin &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">1</span> &nbsp; &nbsp; &nbsp; &nbsp; 17s</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">default &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">1</span> &nbsp; &nbsp; &nbsp; &nbsp; 33m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kubernetes-dashboard &nbsp; <span class="cm-number">1</span> &nbsp; &nbsp; &nbsp; &nbsp; 33m</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl -n kubernetes-dashboard describe serviceaccounts dashboard-admin</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">...</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Mountable secrets: &nbsp; dashboard-admin-token-ggzj4</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Tokens: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  dashboard-admin-token-ggzj4</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Events: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &lt;none&gt;</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl -n kubernetes-dashboard describe secrets dashboard-admin-token-ggzj4 </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">...</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">Data</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-operator">====</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">ca.crt: &nbsp; &nbsp; <span class="cm-number">1099</span> bytes</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">namespace: &nbsp;<span class="cm-number">20</span> bytes</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">token: &nbsp; &nbsp;  eyJhbGciOiJSUzI1NiIsImtpZCI6IkhMYWw5NEppMmF6ZzN5cGZCMVpTaERNcjZ1YXFDc21RSGVnWnhIYVlFMDgifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlcm5ldGVzLWRhc2hib2FyZCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tZ2d6ajQiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiZmVlMjRhMTktYzg3MS00NzE5LTkwZTYtYjJmZmYxMDYyZjEyIiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmVybmV0ZXMtZGFzaGJvYXJkOmRhc2hib2FyZC1hZG1pbiJ9.UoRNvKyeIjC-16wr25A3Bkjfqu7PBpX1k3Nq1i_ifzF60LgIjNYkxH0l5yqkeccNVGn9C_SmC-j17kUTMo4s92832gRnyoAhfgfc0Ls_q8rHRrVdYIaccX5B1iLmoulOiri7-yBN2Z_YRa6bPFWYQexDQ97ql7HVlnpm5cdQtikD2VaWYZrdxE_TT-fnXlmnHYtO_AIwen1MOpOMjk8gcA32YBoDG1cOmOrmCCi9kAmwo9gPNkGty7vPahH0VQ1RNa0Zqm28GGG9kkLoJzdjlwsjsZMrgptY4jDWycltDV3DCDzSd7a5O-hW4eAIm-0R_P74RksAXWH-yqCn7-tKIg</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">把查询到的token值，粘贴到浏览器dashboard的页面，登录，但是并没有具体数据显示，因为还没有权限，需要授权</span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 1054px;"></div><div class="CodeMirror-gutters" style="display: none; height: 1054px;"></div></div></div></pre><h3><a name="角色与鉴权" class="md-header-anchor"></a><span>角色与鉴权</span></h3><blockquote><p><span>Role：用来在某一个名称空间内创建授权角色，创建 Role 时，必须指定所属的名字空间的名字。</span>
<span>ClusterRole：可以和 Role 相同完成授权。但属于集群范围，对所有名称空间有效。</span>
<span>RoleBinding：是将角色中定义的权限赋予一个或者一组用户，可以使用 Role 或 ClusterRole 完成授权。</span>
<span>ClusterRoleBinding 在集群范围执行授权，对所有名称空间有效，只能使用 ClusterRole 完成授权。</span></p></blockquote><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># grep authorization-mode /etc/kubernetes/manifests/kube-apiserver.yaml</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp; &nbsp;<span class="cm-attribute">-</span> <span class="cm-attribute">--authorization-mode</span><span class="cm-operator">=</span>Node,RBAC</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">给角色授权，需要知道可以授哪些权限</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl api-resources  -o wide</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  SHORTNAMES &nbsp; APIVERSION &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; NAMESPACED &nbsp; KIND &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VERBS</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">bindings &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-atom">true</span> &nbsp; &nbsp; &nbsp; &nbsp; Binding &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [create]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">componentstatuses &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cs &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-atom">false</span> &nbsp; &nbsp; &nbsp;  ComponentStatus &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [get list]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">configmaps &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  cm &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; v1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-atom">true</span> &nbsp; &nbsp; &nbsp; &nbsp; ConfigMap &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  [create delete deletecollection <span class="cm-builtin">get</span> list patch update watch]</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># vim myrole.yaml</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: Role</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: rbac.authorization.k8s.io/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: myrole</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">rules:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">-</span> apiGroups: &nbsp; &nbsp; &nbsp; <span class="cm-comment">#资源对象所属组信息</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> <span class="cm-string">""</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#分组信息，pod的apiversion没有分组，为空</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  resources: &nbsp; &nbsp; &nbsp; <span class="cm-comment">#要设置权限的资源对象</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> pods</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  verbs: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#权限设置</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> <span class="cm-builtin">get</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#get权限</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"> &nbsp;<span class="cm-attribute">-</span> list &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#list权限</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: RoleBinding</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: rbac.authorization.k8s.io/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: rolebinding</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">roleRef: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#关联权限</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  apiGroup: rbac.authorization.k8s.io &nbsp;<span class="cm-comment">#角色对象组</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  kind: Role &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#角色对象</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: myrole &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#角色名称</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">subjects: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#授权信息</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">-</span> kind: ServiceAccount &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="cm-comment">#账号资源对象</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: dashboard-admin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-comment">#账号名称</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  namespace: kubernetes-dashboard &nbsp; &nbsp; &nbsp;<span class="cm-comment">#账号所在名称空间</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl apply -f myrole.yaml </span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">授权成功之后，浏览器刷新，找到pods，可以看到pod的资源，但是没有其他权限如删除，可以自行添加</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment">#  kubectl delete -f myrole.yaml </span></span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 1123px;"></div><div class="CodeMirror-gutters" style="display: none; height: 1123px;"></div></div></div></pre><p><span>使用ClusterRole授管理员权限</span></p><pre spellcheck="false" class="md-fences md-end-block ty-contain-cm modeLoaded" lang="shell" style="break-inside: unset;"><div class="CodeMirror cm-s-inner CodeMirror-wrap" lang="shell"><div style="overflow: hidden; position: relative; width: 3px; height: 0px; top: 0px; left: 8.15972px;"><textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea></div><div class="CodeMirror-scrollbar-filler" cm-not-content="true"></div><div class="CodeMirror-gutter-filler" cm-not-content="true"></div><div class="CodeMirror-scroll" tabindex="-1"><div class="CodeMirror-sizer" style="margin-left: 0px; margin-bottom: 0px; border-right-width: 0px; padding-right: 0px; padding-bottom: 0px;"><div style="position: relative; top: 0px;"><div class="CodeMirror-lines" role="presentation"><div role="presentation" style="position: relative; outline: none;"><div class="CodeMirror-measure"><pre><span>xxxxxxxxxx</span></pre></div><div class="CodeMirror-measure"></div><div style="position: relative; z-index: 1;"></div><div class="CodeMirror-code" role="presentation" style=""><div class="CodeMirror-activeline" style="position: relative;"><div class="CodeMirror-activeline-background CodeMirror-linebackground"></div><div class="CodeMirror-gutter-background CodeMirror-activeline-gutter" style="left: 0px; width: 0px;"></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl get clusterrole</span></span></pre></div><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">NAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CREATED AT</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">admin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">2023</span><span class="cm-attribute">-06-13T15</span>:12:32Z</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">cluster-admin &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="cm-number">2023</span><span class="cm-attribute">-06-13T15</span>:12:32Z</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">... ...</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" class="cm-tab-wrap-hack" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># vim user.yaml <span class="cm-tab" role="presentation" cm-text="	"> </span>#文件最后追加</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">...</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span cm-text="">​</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">---</span></span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">apiVersion: rbac.authorization.k8s.io/v1</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">kind: ClusterRoleBinding</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">metadata:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: dashboard-admin</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">roleRef:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  apiGroup: rbac.authorization.k8s.io</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  kind: ClusterRole</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: cluster-admin</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">subjects:</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;"><span class="cm-attribute">-</span> kind: ServiceAccount</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  name: dashboard-admin</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">  namespace: kubernetes-dashboard</span></pre><pre class=" CodeMirror-line " role="presentation"><span role="presentation" style="padding-right: 0.1px;">[root@master dashboard]<span class="cm-comment"># kubectl apply -f user.yaml</span></span></pre></div></div></div></div></div><div style="position: absolute; height: 0px; width: 1px; border-bottom: 0px solid transparent; top: 573px;"></div><div class="CodeMirror-gutters" style="display: none; height: 573px;"></div></div></div></pre><p>&nbsp;</p></div>
</body>
</html>